import math

n = 10


def f(x, y):
    return 3 * x - 2 * y * y - 12


def modEuler(x0, y0, xn):
    (x, y, h) = (x0, y0, (xn - x0) / n)
    for i in range(1, n + 1):
        yp = y + h * f(x, y)
        x = x0 + i * h
        yc = y + h * f(x, yp)
        y = (yp + yc) / 2.0
        print("x[", i, "] =", x, "  y[", i, "] =", y)


def do_calculate():
    (xn, x0, y0) = (0.0, -1.0, 2.0)
    modEuler(x0, y0, xn)


if __name__ == '__main__':
    do_calculate()
